<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8" />
  <title>朱望仔大战大反派</title>
  <meta name="viewport" content="width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no" />
  <meta name="apple-mobile-web-app-capable" content="yes" />
  <meta name="full-screen" content="true" />
  <meta name="screen-orientation" content="portrait" />
  <meta name="x5-fullscreen" content="true" />
  <meta name="360-fullscreen" content="true" />
  <style>
      html,
      body {
        -ms-touch-action: none;
        background: #888888;
        padding: 0;
        border: 0;
        margin: 0;
        height: 100%;
      }
    </style>
</head>

<body>
  <div style="margin: auto; width: 100%; height: 100%;" class="egret-player" data-entry-class="Main" data-orientation="auto" data-scale-mode="fixedNarrow" data-frame-rate="30"
data-content-width="640" data-content-height="1136" data-show-paint-rect="false" data-multi-fingered="2" data-show-fps="false"
data-show-log="false" data-show-fps-style="x:0,y:0,size:12,textColor:0xffffff,bgAlpha:0.9" >
</div>
<script>
  !(function () {
    var url = window.location.href;
    function parseQueryString(url) {
      var arr;
      var res = {};
      //#符号之后的值称为hash，都不会加到request请求中去
      url = url.split("#")[0];
      //获取queryString 第一个？号后面的全是查询字符串
      arr = url.split("?");
      arr.shift();
      var queryStr = arr.join("?");
      //查询字符串为空直接返回 避免出现这样的返回值{"":""}
      if (queryStr.trim().length == 0) {
        return res;
      }

      //获取参数
      arr = queryStr.split("&");
      for (var i = 0; i < arr.length; i++) {
        var itemArr = arr[i].split("=");
        //第一个=号之前的是name 后面的全是值
        var name = itemArr.shift();
        var value = itemArr.join("=");
        res[name] = value;
      }
      return res;
    }
    try {
      var playerInfo = JSON.parse(
        parseQueryString(window.decodeURIComponent(url)).user
      );
    } catch (e) {
      playerInfo = {};
    }
    // 以下解决分享问题
    // 有参数的地址获取到了信息
    // if (playerInfo && playerInfo.openid) {
    //   //  存储到 localstorage
    //   window.localStorage.setItem("PlayerInfo", JSON.stringify(playerInfo));
    //   // 跳转到没参数的
    //   window.location.href = "https://xwfintech.qingke.io/5f195b8dc01e13002c2d7341/";
    // } else {
    //   // 没参数的,先判断 localstorage 是否有信息
    //   // 从localstorage获取信息
    //   var localInfo = window.localStorage.getItem("PlayerInfo");
    //   if (localInfo !== null) {
    //     // 解析数据
    //     localInfo = JSON.parse(localInfo);
    //     // 判断是否存在openid,不存在就跳去获取信息
    //     if (localInfo.openid) {
    //       // 从 localstorage 中获取用户信息
    //       // 有信息不跳转，赋值到全局
    //       window["PlayerInfo"] = localInfo;
    //     } else {
    //       // 官方服务号跳转地址,不存在获取信息时
    //       window.location.href = "https://xwfintech.qingke.io/wxapi/connect/oauth2/authorize?redirect_uri=https://xwfintech.qingke.io/5f195b8dc01e13002c2d7341&scope=snsapi_userinfo";
    //     }
    //   } else {
    //     // 官方服务号跳转地址,不存在获取信息时
    //     window.location.href = "https://xwfintech.qingke.io/wxapi/connect/oauth2/authorize?redirect_uri=https://xwfintech.qingke.io/5f195b8dc01e13002c2d7341&scope=snsapi_userinfo";
    //   }

    // }

  })(window);
  var loadScript = function (list, callback) {
    var loaded = 0;
    var loadNext = function () {
      loadSingleScript(list[loaded], function () {
        loaded++;
        if (loaded >= list.length) {
          callback();
        } else {
          loadNext();
        }
      });
    };
    loadNext();
  };

  var loadSingleScript = function (src, callback) {
    var s = document.createElement("script");
    s.async = false;
    s.src = src;
    s.addEventListener(
      "load",
      function () {
        s.parentNode.removeChild(s);
        s.removeEventListener("load", arguments.callee, false);
        callback();
      },
      false
    );
    document.body.appendChild(s);
  };

  var xhr = new XMLHttpRequest();
  xhr.open("GET", "./manifest.json?v=" + Math.random(), true);
  xhr.addEventListener("load", function () {
    var manifest = JSON.parse(xhr.response);
    var list = manifest.initial.concat(manifest.game);
    loadScript(list, function () {
      /**
       * {
       * "renderMode":, //Engine rendering mode, "canvas" or "webgl"
       * "audioType": 0 //Use the audio type, 0: default, 2: web audio, 3: audio
       * "antialias": //Whether the anti-aliasing is enabled in WebGL mode, true: on, false: off, defaults to false
       * "calculateCanvasScaleFactor": //a function return canvas scale factor
       * }
       **/
      egret.runEgret({
        renderMode: "webgl",
        audioType: 2,
        calculateCanvasScaleFactor: function (context) {
          var backingStore =
            context.backingStorePixelRatio ||
            context.webkitBackingStorePixelRatio ||
            context.mozBackingStorePixelRatio ||
            context.msBackingStorePixelRatio ||
            context.oBackingStorePixelRatio ||
            context.backingStorePixelRatio ||
            1;
          return (window.devicePixelRatio || 1) / backingStore;
        },
      });
    });
  });
  xhr.send(null);
</script>
</body>

</html>